﻿using System;
using System.Collections.Generic;
using Manager;
using UnityEngine;

// Token: 0x02000283 RID: 643
public class CharMaleCustom : global::CharCustom
{
	// Token: 0x06000FAB RID: 4011 RVA: 0x00072F2C File Offset: 0x0007112C
	public CharMaleCustom(global::CharInfo info) : base(info, global::CharDefine.cm_headshapename.Length, global::CharDefine.cm_bodyshapename.Length)
	{
		this.sibFace = new global::ShapeHeadInfoMale();
		this.sibBody = new global::ShapeBodyInfoMale();
		this.maleFile = (this.chaFile as global::CharMaleFile);
		this.maleCustomInfo = (this.customInfo as global::CharFileInfoCustomMale);
	}

	// Token: 0x06000FAC RID: 4012 RVA: 0x00072FF8 File Offset: 0x000711F8
	public virtual void AddUpdateCMFaceTexFlags(bool inpBase, bool inpTatoo)
	{
		if (inpBase)
		{
			this.updateCMFaceTex[0] = inpBase;
		}
		if (inpTatoo)
		{
			this.updateCMFaceTex[1] = inpTatoo;
		}
	}

	// Token: 0x06000FAD RID: 4013 RVA: 0x00073018 File Offset: 0x00071218
	public virtual void AddUpdateCMFaceColorFlags(bool inpBase, bool inpTatoo)
	{
		if (inpBase)
		{
			this.updateCMFaceColor[0] = inpBase;
		}
		if (inpTatoo)
		{
			this.updateCMFaceColor[1] = inpTatoo;
		}
	}

	// Token: 0x06000FAE RID: 4014 RVA: 0x00073038 File Offset: 0x00071238
	public virtual void AddUpdateCMBodyTexFlags(bool inpBase, bool inpTatoo)
	{
		if (inpBase)
		{
			this.updateCMBodyTex[0] = inpBase;
		}
		if (inpTatoo)
		{
			this.updateCMBodyTex[1] = inpTatoo;
		}
	}

	// Token: 0x06000FAF RID: 4015 RVA: 0x00073058 File Offset: 0x00071258
	public virtual void AddUpdateCMBodyColorFlags(bool inpBase, bool inpTatoo)
	{
		if (inpBase)
		{
			this.updateCMBodyColor[0] = inpBase;
		}
		if (inpTatoo)
		{
			this.updateCMBodyColor[1] = inpTatoo;
		}
	}

	// Token: 0x06000FB0 RID: 4016 RVA: 0x00073078 File Offset: 0x00071278
	public virtual global::ListTypeTexture LoatTextureInfo(global::CharaListInfo.TypeMaleTexture type, ref int id, ref Texture2D diffuse, ref Texture normal, ref Texture detail)
	{
		Dictionary<int, global::ListTypeTexture> maleTextureList = this.chaInfo.ListInfo.GetMaleTextureList(type, true);
		if (maleTextureList == null)
		{
			return null;
		}
		return base.LoatTextureInfoBase(maleTextureList, ref id, ref diffuse, ref normal, ref detail);
	}

	// Token: 0x06000FB1 RID: 4017 RVA: 0x000730B0 File Offset: 0x000712B0
	public virtual bool CreateFaceTexture()
	{
		global::CustomTextureControl customTexCtrlFace = this.chaInfo.chaBody.customTexCtrlFace;
		Material customMatFace = this.chaInfo.chaBody.customMatFace;
		if (null == customMatFace)
		{
			return false;
		}
		Texture2D texture2D = null;
		Texture texture = null;
		Texture texture2 = null;
		bool flag = false;
		bool flag2 = false;
		if (this.updateCMFaceTex[0])
		{
			global::ListTypeTexture listTypeTexture = this.LoatTextureInfo(global::CharaListInfo.TypeMaleTexture.cm_t_face, ref this.maleCustomInfo.texFaceId, ref texture2D, ref texture, ref texture2);
			if (listTypeTexture != null)
			{
				customTexCtrlFace.SetMainTexture(texture2D);
				flag = true;
				flag2 = true;
				customMatFace.SetTexture(global::Singleton<Manager.Character>.Instance._BumpMap, texture);
			}
			this.updateCMFaceTex[0] = false;
		}
		if (this.updateCMFaceColor[0])
		{
			global::HSColorSet hscolorSet = this.maleCustomInfo.skinColor;
			customTexCtrlFace.SetColor(global::Singleton<Manager.Character>.Instance._Color, hscolorSet.rgbDiffuse);
			flag = true;
			customMatFace.SetColor(global::Singleton<Manager.Character>.Instance._SpecColor, hscolorSet.rgbSpecular);
			customMatFace.SetFloat(global::Singleton<Manager.Character>.Instance._Metallic, hscolorSet.specularIntensity);
			customMatFace.SetFloat(global::Singleton<Manager.Character>.Instance._Smoothness, hscolorSet.specularSharpness);
			this.updateCMFaceColor[0] = false;
		}
		if (this.updateCMFaceTex[1])
		{
			global::ListTypeTexture listTypeTexture = this.LoatTextureInfo(global::CharaListInfo.TypeMaleTexture.cm_t_tattoo_f, ref this.maleCustomInfo.texTattoo_fId, ref texture2D, ref texture, ref texture2);
			if (listTypeTexture != null)
			{
				customTexCtrlFace.SetTexture(global::Singleton<Manager.Character>.Instance._Texture3, texture2D);
				if (texture2D)
				{
					customTexCtrlFace.SetOffsetAndTiling("_Texture3", 1024, 1024, texture2D.width, texture2D.height, listTypeTexture.PX, listTypeTexture.PY);
				}
				flag = true;
				flag2 = true;
			}
			this.updateCMFaceTex[1] = false;
		}
		if (this.updateCMFaceColor[1])
		{
			global::HSColorSet hscolorSet = this.maleCustomInfo.tattoo_fColor;
			customTexCtrlFace.SetColor(global::Singleton<Manager.Character>.Instance._Color3, hscolorSet.rgbaDiffuse);
			this.updateCMFaceColor[1] = false;
			flag = true;
		}
		if (flag)
		{
			customTexCtrlFace.RebuildTextureAndSetMaterial();
		}
		if (this.releaseCustomInputTexture)
		{
			this.ReleaseFaceCustomTexture();
		}
		if (flag2)
		{
			Resources.UnloadUnusedAssets();
		}
		return true;
	}

	// Token: 0x06000FB2 RID: 4018 RVA: 0x000732C8 File Offset: 0x000714C8
	public virtual bool ChangeFaceDetailTex()
	{
		Texture2D texture2D = null;
		Texture texture = null;
		Texture texture2 = null;
		Material customMatFace = this.chaInfo.chaBody.customMatFace;
		if (null == customMatFace)
		{
			return false;
		}
		global::ListTypeTexture listTypeTexture = this.LoatTextureInfo(global::CharaListInfo.TypeMaleTexture.cm_t_detail_f, ref this.maleCustomInfo.texFaceDetailId, ref texture2D, ref texture, ref texture2);
		if (listTypeTexture != null)
		{
			customMatFace.SetTexture(global::Singleton<Manager.Character>.Instance._BlendNormalMap, texture2);
			Resources.UnloadUnusedAssets();
		}
		return true;
	}

	// Token: 0x06000FB3 RID: 4019 RVA: 0x00073338 File Offset: 0x00071538
	public virtual bool ChangeFaceDetailWeight()
	{
		Material customMatFace = this.chaInfo.chaBody.customMatFace;
		if (null == customMatFace)
		{
			return false;
		}
		customMatFace.SetFloat(global::Singleton<Manager.Character>.Instance._BlendNormalMapScale, this.maleCustomInfo.faceDetailWeight);
		return true;
	}

	// Token: 0x06000FB4 RID: 4020 RVA: 0x00073380 File Offset: 0x00071580
	public virtual bool ReleaseFaceCustomTexture()
	{
		global::CustomTextureControl customTexCtrlFace = this.chaInfo.chaBody.customTexCtrlFace;
		if (customTexCtrlFace == null)
		{
			return false;
		}
		customTexCtrlFace.SetTexture(global::Singleton<Manager.Character>.Instance._MainTex, null);
		customTexCtrlFace.SetTexture(global::Singleton<Manager.Character>.Instance._Texture3, null);
		Resources.UnloadUnusedAssets();
		return true;
	}

	// Token: 0x06000FB5 RID: 4021 RVA: 0x000733D0 File Offset: 0x000715D0
	public virtual bool CreateBodyTexture()
	{
		global::CustomTextureControl customTexCtrlBody = this.chaInfo.chaBody.customTexCtrlBody;
		Material customMatBody = this.chaInfo.chaBody.customMatBody;
		if (null == customMatBody)
		{
			return false;
		}
		Texture2D texture2D = null;
		Texture texture = null;
		Texture texture2 = null;
		bool flag = false;
		if (this.updateCMBodyTex[0])
		{
			global::ListTypeTexture listTypeTexture = this.LoatTextureInfo(global::CharaListInfo.TypeMaleTexture.cm_t_body, ref this.maleCustomInfo.texBodyId, ref texture2D, ref texture, ref texture2);
			if (listTypeTexture != null)
			{
				customTexCtrlBody.SetMainTexture(texture2D);
				flag = true;
			}
			this.updateCMBodyTex[0] = false;
		}
		if (this.updateCMBodyColor[0])
		{
			global::HSColorSet hscolorSet = this.maleCustomInfo.skinColor;
			customTexCtrlBody.SetColor(global::Singleton<Manager.Character>.Instance._Color, hscolorSet.rgbDiffuse);
			flag = true;
			customMatBody.SetColor(global::Singleton<Manager.Character>.Instance._SpecColor, hscolorSet.rgbSpecular);
			customMatBody.SetFloat(global::Singleton<Manager.Character>.Instance._Metallic, hscolorSet.specularIntensity);
			customMatBody.SetFloat(global::Singleton<Manager.Character>.Instance._Smoothness, hscolorSet.specularSharpness);
			this.updateCMBodyColor[0] = false;
		}
		if (this.updateCMBodyTex[1])
		{
			global::ListTypeTexture listTypeTexture = this.LoatTextureInfo(global::CharaListInfo.TypeMaleTexture.cm_t_tattoo_b, ref this.maleCustomInfo.texTattoo_bId, ref texture2D, ref texture, ref texture2);
			if (listTypeTexture != null)
			{
				customTexCtrlBody.SetTexture(global::Singleton<Manager.Character>.Instance._Texture3, texture2D);
				if (texture2D)
				{
					customTexCtrlBody.SetOffsetAndTiling("_Texture3", 1024, 1024, texture2D.width, texture2D.height, listTypeTexture.PX, listTypeTexture.PY);
				}
				flag = true;
			}
			this.updateCMBodyTex[1] = false;
		}
		if (this.updateCMBodyColor[1])
		{
			global::HSColorSet hscolorSet = this.maleCustomInfo.tattoo_bColor;
			customTexCtrlBody.SetColor(global::Singleton<Manager.Character>.Instance._Color3, hscolorSet.rgbaDiffuse);
			this.updateCMBodyColor[1] = false;
			flag = true;
		}
		if (flag)
		{
			customTexCtrlBody.RebuildTextureAndSetMaterial();
		}
		if (this.releaseCustomInputTexture)
		{
			this.ReleaseBodyCustomTexture();
		}
		return true;
	}

	// Token: 0x06000FB6 RID: 4022 RVA: 0x000735C0 File Offset: 0x000717C0
	public virtual bool ChangeBodyDetailTex()
	{
		Texture2D texture2D = null;
		Texture texture = null;
		Texture texture2 = null;
		Material customMatBody = this.chaInfo.chaBody.customMatBody;
		if (null == customMatBody)
		{
			return false;
		}
		global::ListTypeTexture listTypeTexture = this.LoatTextureInfo(global::CharaListInfo.TypeMaleTexture.cm_t_detail_b, ref this.maleCustomInfo.texBodyDetailId, ref texture2D, ref texture, ref texture2);
		if (listTypeTexture != null)
		{
			customMatBody.SetTexture(global::Singleton<Manager.Character>.Instance._BlendNormalMap, texture2);
		}
		return true;
	}

	// Token: 0x06000FB7 RID: 4023 RVA: 0x00073628 File Offset: 0x00071828
	public virtual bool ChangeBodyDetailWeight()
	{
		Material customMatBody = this.chaInfo.chaBody.customMatBody;
		if (null == customMatBody)
		{
			return false;
		}
		customMatBody.SetFloat(global::Singleton<Manager.Character>.Instance._BlendNormalMapScale, this.maleCustomInfo.bodyDetailWeight);
		return true;
	}

	// Token: 0x06000FB8 RID: 4024 RVA: 0x00073670 File Offset: 0x00071870
	public virtual bool ReleaseBodyCustomTexture()
	{
		global::CustomTextureControl customTexCtrlBody = this.chaInfo.chaBody.customTexCtrlBody;
		if (customTexCtrlBody == null)
		{
			return false;
		}
		customTexCtrlBody.SetTexture(global::Singleton<Manager.Character>.Instance._MainTex, null);
		customTexCtrlBody.SetTexture(global::Singleton<Manager.Character>.Instance._Texture3, null);
		return true;
	}

	// Token: 0x06000FB9 RID: 4025 RVA: 0x000736BC File Offset: 0x000718BC
	public override bool InitShapeFace(Transform trfBone, string assetBundleAnmShapeFace, string assetAnmShapeFace)
	{
		if (this.sibFace == null)
		{
			return false;
		}
		if (null == trfBone)
		{
			return false;
		}
		string cateInfoName = "cm_customhead";
		this.sibFace.InitShapeInfo(assetBundleAnmShapeFace, "list/customshape.unity3d", assetAnmShapeFace, cateInfoName, trfBone);
		for (int i = 0; i < this.ShapeFaceNum; i++)
		{
			this.sibFace.ChangeValue(i, this.customInfo.shapeValueFace[i]);
		}
		this.chaInfo.chaBody.updateShapeFace = true;
		return true;
	}

	// Token: 0x06000FBA RID: 4026 RVA: 0x00073744 File Offset: 0x00071944
	public override bool InitShapeBody(Transform trfBone)
	{
		if (this.sibBody == null)
		{
			return false;
		}
		if (null == trfBone)
		{
			return false;
		}
		string anmKeyInfoName = "cm_anmShapeBody";
		string cateInfoName = "cm_custombody";
		this.sibBody.InitShapeInfo("list/customshape.unity3d", "list/customshape.unity3d", anmKeyInfoName, cateInfoName, trfBone);
		for (int i = 0; i < this.ShapeBodyNum; i++)
		{
			this.sibBody.ChangeValue(i, this.customInfo.shapeValueBody[i]);
		}
		this.chaInfo.chaBody.updateShapeBody = true;
		return true;
	}

	// Token: 0x06000FBB RID: 4027 RVA: 0x000737D4 File Offset: 0x000719D4
	public override bool SetShapeBodyValue(int index, float value)
	{
		if (index >= this.ShapeBodyNum)
		{
			return false;
		}
		this.customInfo.shapeValueBody[index] = value;
		if (this.sibBody != null && this.sibBody.InitEnd)
		{
			this.sibBody.ChangeValue(index, value);
		}
		this.chaInfo.chaBody.updateShapeBody = true;
		return true;
	}

	// Token: 0x06000FBC RID: 4028 RVA: 0x00073838 File Offset: 0x00071A38
	public override float GetShapeBodyValue(int index)
	{
		if (index >= this.ShapeBodyNum)
		{
			return 0f;
		}
		return this.customInfo.shapeValueBody[index];
	}

	// Token: 0x06000FBD RID: 4029 RVA: 0x0007385C File Offset: 0x00071A5C
	public override void UpdateShapeBody()
	{
		if (this.sibBody == null || !this.sibBody.InitEnd)
		{
			return;
		}
		this.sibBody.Update();
	}

	// Token: 0x06000FBE RID: 4030 RVA: 0x00073888 File Offset: 0x00071A88
	public override void ChangeHairColor(int parts)
	{
		this.ChangeHairColor(parts, this.maleCustomInfo.hairColor[parts]);
	}

	// Token: 0x06000FBF RID: 4031 RVA: 0x000738A0 File Offset: 0x00071AA0
	public override void ChangeHairColor(int parts, global::HSColorSet color)
	{
		global::CharReference.TagObjKey[] array = new global::CharReference.TagObjKey[1];
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(array[parts]);
		if (tagInfo.Count == 0)
		{
			return;
		}
		this.maleCustomInfo.hairColor[parts].Copy(color);
		global::ColorChange.SetHSColor(tagInfo, color, true, true, null, true, true);
	}

	// Token: 0x06000FC0 RID: 4032 RVA: 0x000738F0 File Offset: 0x00071AF0
	public override void ChangeHairAcsColor(int parts)
	{
		this.ChangeHairAcsColor(parts, this.maleCustomInfo.hairAcsColor[parts]);
	}

	// Token: 0x06000FC1 RID: 4033 RVA: 0x00073908 File Offset: 0x00071B08
	public override void ChangeHairAcsColor(int parts, global::HSColorSet color)
	{
		global::CharReference.TagObjKey[] array = new global::CharReference.TagObjKey[]
		{
			global::CharReference.TagObjKey.ObjHairAcsB
		};
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(array[parts]);
		if (tagInfo.Count == 0)
		{
			return;
		}
		this.maleCustomInfo.hairAcsColor[parts].Copy(color);
		global::ColorChange.SetHSColor(tagInfo, color, true, true, null, true, true);
	}

	// Token: 0x06000FC2 RID: 4034 RVA: 0x0007395C File Offset: 0x00071B5C
	public override void UpdateAllCustom()
	{
	}

	// Token: 0x06000FC3 RID: 4035 RVA: 0x00073960 File Offset: 0x00071B60
	public override void ChangeCustomFaceWithoutCustomTexture()
	{
		this.ChangeEyebrow();
		this.ChangeEyeWColor();
		this.ChangeEyeL();
		this.ChangeEyeR();
		this.ChangeBeard();
		this.ChangeFaceDetailTex();
		this.ChangeFaceDetailWeight();
		base.SetFaceBaseMaterial();
	}

	// Token: 0x06000FC4 RID: 4036 RVA: 0x00073998 File Offset: 0x00071B98
	public override void ChangeCustomBodyWithoutCustomTexture()
	{
		this.ChangeBodyDetailTex();
		this.ChangeBodyDetailWeight();
		base.SetBodyBaseMaterial();
	}

	// Token: 0x06000FC5 RID: 4037 RVA: 0x000739B0 File Offset: 0x00071BB0
	public override void ChangeEyebrow()
	{
		Dictionary<int, global::ListTypeMaterial> maleMaterialList = this.chaInfo.ListInfo.GetMaleMaterialList(global::CharaListInfo.TypeMaleMaterial.cm_m_eyebrow, true);
		base.ChangeMaterial(ref this.maleCustomInfo.matEyebrowId, maleMaterialList, global::CharReference.TagObjKey.ObjEyebrow);
		this.ChangeEyebrowColor();
	}

	// Token: 0x06000FC6 RID: 4038 RVA: 0x000739EC File Offset: 0x00071BEC
	public override void ChangeEyebrowColor()
	{
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(global::CharReference.TagObjKey.ObjEyebrow);
		global::ColorChange.SetHSColor(tagInfo, this.maleCustomInfo.eyebrowColor, true, true, null, true, true);
	}

	// Token: 0x06000FC7 RID: 4039 RVA: 0x00073A20 File Offset: 0x00071C20
	public override void ChangeEyeWColor()
	{
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(global::CharReference.TagObjKey.ObjEyeW);
		global::ColorChange.SetHSColor(tagInfo, this.maleCustomInfo.eyeWColor, true, true, null, true, true);
	}

	// Token: 0x06000FC8 RID: 4040 RVA: 0x00073A54 File Offset: 0x00071C54
	public override void ChangeEyeL()
	{
		Dictionary<int, global::ListTypeMaterial> maleMaterialList = this.chaInfo.ListInfo.GetMaleMaterialList(global::CharaListInfo.TypeMaleMaterial.cm_m_eyeball, true);
		base.ChangeMaterial(ref this.maleCustomInfo.matEyeLId, maleMaterialList, global::CharReference.TagObjKey.ObjEyeL);
		this.ChangeEyeLColor();
	}

	// Token: 0x06000FC9 RID: 4041 RVA: 0x00073A90 File Offset: 0x00071C90
	public override void ChangeEyeLColor()
	{
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(global::CharReference.TagObjKey.ObjEyeL);
		global::ColorChange.SetHSColor(tagInfo, this.maleCustomInfo.eyeLColor, true, true, null, true, true);
	}

	// Token: 0x06000FCA RID: 4042 RVA: 0x00073AC4 File Offset: 0x00071CC4
	public override void ChangeEyeR()
	{
		Dictionary<int, global::ListTypeMaterial> maleMaterialList = this.chaInfo.ListInfo.GetMaleMaterialList(global::CharaListInfo.TypeMaleMaterial.cm_m_eyeball, true);
		base.ChangeMaterial(ref this.maleCustomInfo.matEyeRId, maleMaterialList, global::CharReference.TagObjKey.ObjEyeR);
		this.ChangeEyeRColor();
	}

	// Token: 0x06000FCB RID: 4043 RVA: 0x00073B00 File Offset: 0x00071D00
	public override void ChangeEyeRColor()
	{
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(global::CharReference.TagObjKey.ObjEyeR);
		global::ColorChange.SetHSColor(tagInfo, this.maleCustomInfo.eyeRColor, true, true, null, true, true);
	}

	// Token: 0x06000FCC RID: 4044 RVA: 0x00073B34 File Offset: 0x00071D34
	public virtual void ChangeBeard()
	{
		Dictionary<int, global::ListTypeMaterial> maleMaterialList = this.chaInfo.ListInfo.GetMaleMaterialList(global::CharaListInfo.TypeMaleMaterial.cm_m_beard, true);
		base.ChangeMaterial(ref this.maleCustomInfo.matBeardId, maleMaterialList, global::CharReference.TagObjKey.ObjBeard);
		this.ChangeBeardColor();
	}

	// Token: 0x06000FCD RID: 4045 RVA: 0x00073B70 File Offset: 0x00071D70
	public virtual void ChangeBeardColor()
	{
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(global::CharReference.TagObjKey.ObjBeard);
		global::ColorChange.SetHSColor(tagInfo, this.maleCustomInfo.beardColor, true, true, null, true, true);
	}

	// Token: 0x0400111A RID: 4378
	public global::CharMaleFile maleFile;

	// Token: 0x0400111B RID: 4379
	public global::CharFileInfoCustomMale maleCustomInfo;

	// Token: 0x0400111C RID: 4380
	public bool[] updateCMFaceTex = new bool[Enum.GetNames(typeof(global::CharMaleCustom.CM_FaceTexKind)).Length];

	// Token: 0x0400111D RID: 4381
	public bool[] updateCMFaceColor = new bool[Enum.GetNames(typeof(global::CharMaleCustom.CM_FaceTexKind)).Length];

	// Token: 0x0400111E RID: 4382
	public bool[] updateCMBodyTex = new bool[Enum.GetNames(typeof(global::CharMaleCustom.CM_BodyTexKind)).Length];

	// Token: 0x0400111F RID: 4383
	public bool[] updateCMBodyColor = new bool[Enum.GetNames(typeof(global::CharMaleCustom.CM_BodyTexKind)).Length];

	// Token: 0x04001120 RID: 4384
	static int WIDESLIDER_080;

	// Token: 0x04001121 RID: 4385
	static int WIDESLIDER_082;

	// Token: 0x02000284 RID: 644
	public enum CM_FaceTexKind
	{
		// Token: 0x04001123 RID: 4387
		inpBase,
		// Token: 0x04001124 RID: 4388
		inpTatoo
	}

	// Token: 0x02000285 RID: 645
	public enum CM_BodyTexKind
	{
		// Token: 0x04001126 RID: 4390
		inpBase,
		// Token: 0x04001127 RID: 4391
		inpTatoo
	}
}
